package com.itnoob.strategy.service.impl;

import com.itnoob.strategy.service.PayService;
import com.itnoob.strategy.service.PayStrategy;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author zhoujun
 * @date 2024/12/5 22:45
 */
@Service
public class PayServiceImpl  implements PayService{

    private  PayStrategy payStrategy;

    @Override
    public void setStrategy(PayStrategy payStrategy) {
        this.payStrategy = payStrategy;
    }


    /**
     * 定义一个方法用于执行策略的算法
     * @param amount
     * @return
     */
    @Override
    public String pay(BigDecimal amount) {
        return payStrategy.pay(amount);
    }
}
